OpenWRT使用4G模块上网和发送短信

您所在的位置:网站首页 openwrt 4g模块 luci OpenWRT使用4G模块上网和发送短信

OpenWRT使用4G模块上网和发送短信

2024-06-23 16:20| 来源: 网络整理| 查看: 265

1、配置ppp

配置参考:https://blog.csdn.net/qianguozheng/article/details/50543704

结果就是:lsusb能发现HUAWEI的4G模块,ifconfig能看到3g-ppp0口

2、测试上网功能

ping www.baidu.com是ok的

3、测试短信发送功能

   a、使用minicom -s    //参考https://www.cnblogs.com/zhangchaoyang/articles/1926848.html

   b、使用minicom -b  115200 -o -D  /dev/ttyUSB2

4、使用脚本发送短信

root@OpenWrt:~# cat test.lua //编写脚本 wserial=io.open("/dev/ttyUSB2","w") wserial:write("AT\r") wserial:write("AT+CMGF=1\r") wserial:write("AT+CMGS=\"18062556426\"\r") wserial:write("hello yiwei\26\r") wserial:flush() wserial:close() root@OpenWrt:~# lua test.lua //发送短信

5、使用web创建ppp0接口

    在web的INTERFACE下添加接口,注意Protocol要跟图中一致,然后设备重启

6、查看配置文件

ssh下查看/etc/config/network,发现出现了ppp的配置

config interface 'loopback' option ifname 'lo' option proto 'static' option ipaddr '127.0.0.1' option netmask '255.0.0.0' config globals 'globals' option ula_prefix 'fd74:c690:a8eb::/48' config interface 'lan' option type 'bridge' option ifname 'eth0' option proto 'static' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option ip6assign '60' config interface 'ppp0' option proto '3g' option device '/dev/ttyUSB0' option service 'umts' option apn '3gnet' option dialnumber '*99#' option ipv6 'auto'


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3